package com.bailiban;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zhulang
 * @Classname DateUtils
 * @Description DateUtils
 */
public class DateUtils {
    public static String date2String(Date date, String pattern) {
        DateFormat dateFormat = new SimpleDateFormat(pattern);
        String dateStr = dateFormat.format(date);
        return dateStr;
    }

    public static Date string2Date(String date, String pattern) throws ParseException {
        DateFormat dateFormat = new SimpleDateFormat(pattern);
        Date dateP = dateFormat.parse(date);
        return dateP;
    }
}
